package com.prime.tutorial.moviestore.service.customer;

import com.prime.tutorial.moviestore.dao.*;
import com.prime.tutorial.moviestore.domain.CustomerGroups;
import com.prime.tutorial.moviestore.domain.Customers;
import com.prime.tutorial.moviestore.domain.PayCard;
import com.prime.tutorial.moviestore.domain.Payment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: vasylja
 * Date: May 6, 2010
 * Time: 8:28:53 PM
 *
 * @author vasylja
 */

@Service
public class CustomerServiceImpl implements CustomerService{
    private CustomerGroupsDAO customerGroupsDAO;
    private CustomerDAO customerDAO;
    private PayCardDAO payCardDAO;
    private PaymentDAO paymentDAO;
    private RatesDAO ratesDAO;

    @Autowired
    public CustomerServiceImpl(CustomerGroupsDAO customerGroupsDAO, CustomerDAO customerDAO, PayCardDAO payCardDAO,
                               PaymentDAO paymentDAO) {
        this.setCustomerGroupsDAO(customerGroupsDAO);
        this.setCustomerDAO(customerDAO);
        this.setPayCardDAO(payCardDAO);
        this.setPaymentDAO(paymentDAO);
    }

    public List<CustomerGroups> getAllCustomerGroups() {
//        return getCustomerGroupsDAO().loadAll();
        List<CustomerGroups> testGroups =new ArrayList<CustomerGroups>();
        testGroups.add(new CustomerGroups("private"));
        testGroups.add(new CustomerGroups("corporate"));
        return testGroups;
    }

    public List<Customers> getAllCustomers() {
        return null;
// TODO Check whether I need this. (Maybe for admin, but not here in customer)
    }

    public Boolean loginExists(String login) {
//        return !(getCustomerDAO().findByLogin(login).isEmpty());
        return null;
    }

    public List<CustomerGroups> findByName(String name) {
//        return getCustomerGroupsDAO().findByName(name);
        return null;
    }

    public void createNew(Customers customer) {
//        getCustomerDAO().persist(customer);

    }

    public void deleteCustomer(Customers customer) {
//        getCustomerDAO().delete(customer);
    }

    public void updateCustomer(Customers customer) {
//        getCustomerDAO().update(customer);
    }

    public Boolean checkCardExists(Long code) {
//        return getPayCardDAO().findByCode(code).isEmpty();
        return null;
    }

    public List<PayCard> getCardWithCode(Long code) {
//        return getPayCardDAO().findByCode(code);
        return null;
    }

    public void makePayment(Payment payment) {
        getPaymentDAO().persist(payment);
    }

    public List getAllRatesForCustomer(Customers customer) {
//       return getRatesDAO().getAllRateForCustomer(customer);
        return null;
    }

    public List getAllPaymentsForCustomer(Customers customer) {
//        return getPaymentDAO().getAllPaymentsForCustomer(customer);
        return null;  
    }


    public CustomerGroupsDAO getCustomerGroupsDAO() {
        return customerGroupsDAO;
    }

    public void setCustomerGroupsDAO(CustomerGroupsDAO customerGroupsDAO) {
        this.customerGroupsDAO = customerGroupsDAO;
    }

    public CustomerDAO getCustomerDAO() {
        return customerDAO;
    }

    public void setCustomerDAO(CustomerDAO customerDAO) {
        this.customerDAO = customerDAO;
    }

    public PayCardDAO getPayCardDAO() {
        return payCardDAO;
    }

    public void setPayCardDAO(PayCardDAO payCardDAO) {
        this.payCardDAO = payCardDAO;
    }

    public PaymentDAO getPaymentDAO() {
        return paymentDAO;
    }

    public void setPaymentDAO(PaymentDAO paymentDAO) {
        this.paymentDAO = paymentDAO;
    }

    public RatesDAO getRatesDAO() {
        return ratesDAO;
    }

    public void setRatesDAO(RatesDAO ratesDAO) {
        this.ratesDAO = ratesDAO;
    }
}
